Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with npm #337

Open
chadoh opened this issue Dec 16, 2020 · 2 comments
Open

Does not work with npm #337

chadoh opened this issue Dec 16, 2020 · 2 comments
Assignees
Labels
bug Something isn't working T-dev-tools

Comments

@chadoh
Copy link
Contributor

chadoh commented Dec 16, 2020

Describe the bug
Adding near-sdk-as to a project currently fails when using npm (it works with yarn)

 ⮀ npm i -S near-sdk-as

> near-vm@1.1.0 preinstall /Users/chadoh/code/proj/node_modules/near-vm
 > node ./uninstall.js

npm WARN near-sdk-bindgen@2.1.2 requires a peer of assemblyscript@^0.9.4 but none is installed. You must install peer dependen
 cies yourself.
 npm WARN visitor-as@0.3.2 requires a peer of assemblyscript@^0.13.3 but none is installed. You must install peer dependencies
 yourself.
 npm WARN @as-pect/cli@4.0.0 requires a peer of assemblyscript@^0.12.0 but none is installed. You must install peer dependencie
 s yourself.
 npm WARN @as-pect/assembly@4.0.0 requires a peer of assemblyscript@^0.12.0 but none is installed. You must install peer depend
 encies yourself.
 npm WARN @as-pect/core@4.0.0 requires a peer of assemblyscript@^0.12.0 but none is installed. You must install peer dependenci
 es yourself.
 npm WARN proj@1.0.0 No description
 npm WARN proj@1.0.0 No repository field.

npm ERR! code ENOENT
 npm ERR! syscall chmod
 npm ERR! path /Users/chadoh/code/proj/node_modules/asbuild/bin/asp
 npm ERR! errno -2
 npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/chadoh/code/proj/node_modules/asbuild/bin/asp'
 npm ERR! enoent This is related to npm not being able to find a file.
 npm ERR! enoent

To Reproduce
Steps to reproduce the behavior:
1. initialize a new project with npm init. I used Node 12.
2. Run npm i -S near-sdk-as

Expected behavior
near-sdk-as should always work with npm in addition to yarn

Screenshots

Screen Shot 2020-12-15 at 20 19 29

@chadoh chadoh added the bug Something isn't working label Dec 16, 2020
@chadoh
Copy link
Contributor Author

chadoh commented Dec 16, 2020

@willemneal this also means that packages are not installed correctly for AssemblyScript projects created with create-near-app. Specifically, asbuild is not installed, so npm run build, which runs asb, does not work.

I've tried reverting to older versions of near-sdk-as in create-near-app's contract/package.json, but near-sdk-as uses a ^ version specification for asbuild. This means that in versions of near-sdk-as that use "asbuild": "^0.0.8", npm will still use asbuild@0.0.9, which is probably where the problem was introduced.

@chadoh
Copy link
Contributor Author

chadoh commented Dec 16, 2020

Have also tried this in my project:

  "dependencies": {
    "near-sdk-as": "2.1.0",
    "asbuild": "0.0.8"
  },

I still get the error, even before npm gets to the step of creating a package-lock.json, so I can't tell if it tried to use the correct version of asbuild.

chadoh added a commit to near/create-near-app that referenced this issue Dec 16, 2020
Works around near/near-sdk-as#337

create-near-app is currently broken with all 2.x.x versions of
near-sdk-as. Using v1.0.0 works, so let's roll back for now.

Also, this uses a specific version, since contracts can be even more
sensitive to version changes than frontend apps, and we already started
being more careful with our frontend package.json versioning:
#532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working T-dev-tools
Projects
None yet
Development

No branches or pull requests

2 participants