This repository was archived by the owner on Aug 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
"npm link" results in "permission denied" #35
Copy link
Copy link
Open
Description
By following the tutorial the npm link
command results in a "permission denied" error message. I already purged the whole project directory and started all over. The issue remained:
$ cargo generate --git https://github.com/rustwasm/wasm-pack-template
Project Name: wasm-game-of-life
Creating project called `wasm-game-of-life`...
Done! New project created /home/user/dev/wasm-game-of-life
$ cd wasm-game-of-life/
.../wasm-game-of-life$ wasm-pack init
[1/8] Checking crate configuration...
[2/8] Adding WASM target...
[3/8] Compiling to WASM...
[4/8] Creating a pkg directory...
[5/8] Writing a package.json...
:-) [WARN]: Field description is missing from Cargo.toml. It is not necessary, but recommended
:-) [WARN]: Field repository is missing from Cargo.toml. It is not necessary, but recommended
:-) [WARN]: Field license is missing from Cargo.toml. It is not necessary, but recommended
[6/8] Copying over your README...
[7/8] Installing WASM-bindgen...
[8/8] Running WASM-bindgen...
:-) Done in 5 minutes
| :-) Your WASM pkg is ready to publish at "./pkg".
.../wasm-game-of-life$ npm init wasm-app www
npx: installed 1 in 1.436s
🦀 Rust + 🕸 Wasm = ❤
.../wasm-game-of-life$ cd www
.../wasm-game-of-life/www$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 550 packages from 405 contributors and audited 6365 packages in 5.006s
found 0 vulnerabilities
.../wasm-game-of-life/www$ cd ../pkg/
.../wasm-game-of-life/pkg$ npm link
npm ERR! path /home/user/dev/wasm-game-of-life/pkg
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '/home/user/dev/wasm-game-of-life/pkg' -> '/usr/local/lib/node_modules/wasm-game-of-life'
npm ERR! { Error: EACCES: permission denied, symlink '/home/user/dev/wasm-game-of-life/pkg' -> '/usr/local/lib/node_modules/wasm-game-of-life'
npm ERR! stack: 'Error: EACCES: permission denied, symlink \'/home/user/dev/wasm-game-of-life/pkg\' -> \'/usr/local/lib/node_modules/wasm-game-of-life\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '/home/user/dev/wasm-game-of-life/pkg',
npm ERR! dest: '/usr/local/lib/node_modules/wasm-game-of-life' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2018-09-04T20_55_20_981Z-debug.log
The log adds the following information:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'link' ]
2 info using npm@6.4.1
3 info using node@v8.10.0
4 verbose linkPkg /home/user/dev/wasm-game-of-life/pkg
5 verbose stack Error: EACCES: permission denied, symlink '/home/user/dev/wasm-game-of-life/pkg' -> '/usr/local/lib/node_modules/wasm-game-of-life'
6 verbose cwd /home/user/dev/wasm-game-of-life/pkg
7 verbose Linux 4.15.0-33-generic
8 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "link"
9 verbose node v8.10.0
10 verbose npm v6.4.1
The message is misleading, though. The link target simply doesn't exist:
$ ls -lap /usr/local/lib/node_modules/
total 12
drwxr-xr-x 3 root root 4096 Sep 4 22:27 ./
drwxr-xr-x 5 root root 4096 Sep 4 22:27 ../
drwxr-xr-x 10 nobody user 4096 Sep 4 22:27 npm/
Did I miss a step?
felicio and mwjaco
Metadata
Metadata
Assignees
Labels
No labels